# 1.他是一个缓存系统，存放一些不重要的数据

# telnet 127.0.0.1 11211登录
# 常用命令
# set设置值在memcached里key-value存在就替换
# set key 0[是否压缩] 60[过期时间] 7[字符长度]
# get key
# add新增值
# delete key
# flush_all全部删除
# incr key可以增加值
# decr可以减法
# stats查看信息
# python操作


# import memcache
#
# mc = memcache.Client(['127.0.0.1:11211'], debug=True)
# # 采取分布式，随即存
# # mc = memcache.Client(['127.0.0.1:11211', '其他ip'], debug=True)
# # mc.set(key="username", val="dimingda", time=120)
# # dic = {
# #     'article': '西游记',
# #     'page': 1333
# # }
# # mc.set_multi(dic)
# # mc.delete("username")
# # mc.incr("name", 2)
# print(mc.get("username"))

# 能够设置防火墙，开启固定端口，让别人访问不到


# django设置memcached
from django.core.cache import cache
from django.http import HttpResponse


# def index(request):
#     cache.set("username", "dimingda", 120)
#     username = cache.get("username")
#     print(username)
#     return HttpResponse("sss")



